package ai.fabu.dataplatform.bean.groupdata;

import ai.fabu.dataplatform.utils.TimeUtil;
import com.google.common.primitives.Longs;
import lombok.Setter;
import lombok.Value;
import lombok.experimental.NonFinal;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.util.HashMap;
import java.util.Map;

import static ai.fabu.dataplatform.constant.ConstantName.CREATE_TIME;
import static ai.fabu.dataplatform.constant.ConstantName.UPDATE_TIME;

@Value
@Document(collection = "vehicle_name")
public class VehicleNameData {
    public static VehicleNameData staticVehicleNameData(String vehicleName){
        Map<String, byte[]> metadata = new HashMap<>();
        metadata.put(CREATE_TIME, TimeUtil.getNowTimestampLong().toString().getBytes());
        metadata.put(UPDATE_TIME, TimeUtil.getNowTimestampLong().toString().getBytes());
        return new VehicleNameData(null, vehicleName, metadata);
    }

    @NonFinal
    @Setter
    @Id
    ObjectId Id;
    @Field("vehicle_name")
    String vehicleName;
    Map<String, byte[]> metadata;
}
